package kz.pompei.var.instruction;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import kz.pompei.var.atom.AtomBracket;

public class GroupInstruction extends Instruction implements InstructionList {
  
  private final List<Instruction> children = new ArrayList<Instruction>();
  
  private AtomBracket start, end;
  
  @Override
  public Iterator<Instruction> iterator() {
    return children.iterator();
  }
  
  public List<Instruction> getChildren() {
    return children;
  }
  
  @Override
  public void addChild(Instruction instruction) {
    children.add(instruction);
    instruction.setParent(this);
  }
  
  public AtomBracket getEnd() {
    return end;
  }
  
  public void setEnd(AtomBracket end) {
    this.end = end;
  }
  
  public AtomBracket getStart() {
    return start;
  }
  
  public void setStart(AtomBracket start) {
    this.start = start;
  }
}
